<template>
	<view class="container">
		<u-toast ref="uToast"></u-toast>
<!--    v-if="step===1&&!user"-->
		<view>
      <view>
        <scroll-view scroll-y="true" style="height: 100vh;width: 100%">
          <image src="https://www.scivisco.com/prod-api/api/download/214"
                 mode="widthFix"  style="width: 100%;min-height: 1590px;"></image>
          <view style="height: 160px"></view>
        </scroll-view>
      </view>
		</view>
		<customTabbar />
	</view>
</template>

<script>
	import customTabbar from '@/components/custom_tabbar.vue'
  import store from 'store/index.js';//需要引入store
	import {
		mapState,
		mapActions,
		mapMutations
	} from 'vuex';
	export default {
		computed: {
			...mapState(['count', 'user', 'wxUserInfo']),
			...mapState({
				user: state => state.user,
        wxUserInfo: state => state.wxUserInfo
			})
		},
		components: {
			customTabbar
		},
		data() {
			return {
				step: 1,
				agreement: [],
        Status:false,
        userInfo:{},
        user_code:null
			}
		},
		watch: {
			user: {
				handler(newVal, oldVal) {
					this.step = 2;
					console.log("watchuser", newVal, oldVal)
				},
				deep: true
			}
		},
		onLoad() {
			let that = this;
      if(that.user){
        that.step = 2;
      }
		},
		onShow() {},
		methods: {

      openLogin(){
        this.Status = false
        this.$store.commit('setWxUserInfo', this.userInfo);
        this.login({
          userInfo:this.userInfo,
          phoneCode:this.user_code
        });
      },
			showToast(msg, type = "default") {
				this.$refs.uToast.show({
					type: type,
					message: msg,
				});
			},
			getUserProfile() {
				if (this.agreement.length > 0) {
          uni.getUserProfile({
            desc: '用于完善会员资料', // 必填，必须告知用户需要获取的信息用途
            success: (res) => {
              this.userInfo = res
              this.Status = true
              console.log('用户信息',res);
            },
            fail: (res) => {
              console.log("用户拒绝了请求", res);
              // 用户拒绝提供信息时的处理逻辑
            }
          });
				} else {
					this.showToast("请确认用户协议和隐私政策。")
				}
			},
			// goRegisterCompany() {
			// 	uni.navigateTo({
			// 		url: "/pages/mine/registerCompany"
			// 	})
			// },
			goRecycle() {
				uni.switchTab({
					url: "/pages/recycle/recycle"
				})
			},
			goUserAgreement() {
				uni.navigateTo({
					url: "/pages/index/agreement"
				})
			},
			goPrivacyPolicy() {
				uni.navigateTo({
					url: "/pages/index/privacyPolicy"
				})
			},
			...mapActions(['login'])
		},
    onShareAppMessage() {
      return{
        title:'科动赫',
        path:'/pages/index/index'
      }
    }
	}
</script>

<style lang="scss">
.ddisp >view{
  display: inline-block;
  margin: 0 auto;
  text-align: center;
}
.responsive-image {
  width: 100%;              /* 图片宽度100% */
  height: 100%;             /* 设置为100%以撑满父级 */
  object-fit: cover;        /* 保持比例填充 */
}
	.agreementDiv {
		width: 100%;
		position: absolute;
		left: 0;
		bottom: 200rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		font-size: 28rpx;
		color: #999;

		.link {
			font-size: 28rpx;
			color: #0080FF;
		}
	}

	.loginBtn {
		margin-top: 168rpx;
		width: 590rpx;
		height: 96rpx;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		flex-grow: 0;
		flex-shrink: 0;
		height: 176rpx;
		width: 176rpx;
		margin-top: 188rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 40rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #333;
	}

	.beginDiv {
		.logo {
			width: 400rpx;
			height: 400rpx;
		}

		.loginBtn {
			margin-top: 0;
		}
	}

	.registerDiv {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		padding: 0px;
		margin: 258rpx auto 0;
		width: 622rpx;
		height: 460rpx;
		position: relative;

		background: linear-gradient(180deg, rgba(206, 239, 254, 0.5) 0%, #FFFFFF 50%);
		box-shadow: 0px 0px 8px 4px rgba(229, 229, 229, 0.3);
		border-radius: 16px;

		.logo {
			margin-top: -100rpx;
		}

		.reg_title {
			color: #333;
			font-size: 36rpx;
			margin-bottom: 20rpx;
		}

		.reg_desc {
			color: #969799;
			font-size: 28rpx;
			margin-bottom: 80rpx;
		}

		.regBtn {
			display: flex;
			justify-content: center;
			align-items: center;
			color: #fff;
			font-size: 32rpx;
			width: 486rpx;
			height: 96rpx;
			background: #0080FF;
			border-radius: 8rpx;

			.ico {
				width: 40rpx;
				height: 40rpx;
				margin-left: 28rpx;
			}
		}
	}
</style>
